#include <iostream>
#include <cstring>

#include "core.h"

//coreNode *
//NodeDirectory::nodes[] =
//{
//    new coreNode("/"),
//    new coreNode("/armor"),
//    new coreNode("/computer"),
//    new coreNode("/computer/core"),
//    new coreNode("/computer/acquisition"),
//    new coreNode("/computer/scanning"),
//    new coreNode("/power"),
//    new coreNode("/weapons")
//};

NodeDirectory::NodeDirectory()
{
    //nodes = new coreNode * [8];
    nodes[root] = new coreNode("/");
    nodes[armor] = new coreNode("/armor");
    nodes[cpu] = new coreNode("/computer");
    nodes[cpuCore] = new coreNode("/computer/core");
    nodes[cpuTarget] = new coreNode("/computer/acquisition");
    nodes[cpuScan] = new coreNode("/computer/scanning");
    nodes[power] = new coreNode("/power");
    nodes[weapons] = new coreNode("/weapons");

    nodes[root]->children = nodes[armor];
    nodes[armor]->parent = nodes[root];
    nodes[armor]->next = nodes[cpu];
    nodes[cpu]->parent = nodes[root];
    nodes[cpu]->next = nodes[cpuCore];
    nodes[cpuCore]->parent = nodes[root];
    nodes[cpuCore]->next = nodes[cpuTarget];
    nodes[cpuTarget]->parent = nodes[root];
    nodes[cpuTarget]->next = nodes[cpuScan];
    nodes[cpuScan]->parent = nodes[root];
    nodes[cpuScan]->next = nodes[power];
    nodes[power]->parent = nodes[root];
    nodes[power]->next = nodes[weapons];
    nodes[weapons]->parent = nodes[root];
    nodes[weapons]->next = NULL;
    _pwd = 0;
}

coreNode::coreNode(const char * n)
{
    std::strcpy(name,n);
    parent = next = children = NULL;
}
